package com.demo11.dao;

import com.demo11.pojo.User;
import org.mybatis.spring.support.SqlSessionDaoSupport;

import java.util.List;

public class UserMapperImpl extends SqlSessionDaoSupport implements UserMapper {
    @Override
    public List<User> selectUser() {

        UserMapper mapper = getSqlSession().getMapper(UserMapper.class);

        User user = new User(3, "wangwu", "wangwu");

        addUser(user);

        deleteUser(3);

        return mapper.selectUser();
    }

    @Override
    public int addUser(User user) {
        UserMapper mapper = getSqlSession().getMapper(UserMapper.class);
        return mapper.addUser(user);
    }

    @Override
    public int deleteUser(int id) {
        return getSqlSession().getMapper(UserMapper.class).deleteUser(id);
    }
}
